﻿using LanDBom.Models;
using LanDBom.Models.Detailed;
using NPOI.HSSF.UserModel;
using NPOI.SS.UserModel;
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Mvc;

namespace LanDBom.Controllers
{
    public class ExcelController : Controller
    {
        LDbaseEntities db = new LDbaseEntities();
        // GET: Excel
        public ActionResult Index()
        {
            return View();
        }
       /* public void ExportToExcel()
        {
            string nsmaes = "SQ20231249145274";
            //var data = projectDS.GetProjectMessage(11);
            var data = db.BOMini.Where(s=>s.BOM2_bian== nsmaes).ToList();
            DataTable dtData = new DataTable();
            dtData.Columns.Add("项目名称", typeof(string));
            dtData.Columns.Add("负责人", typeof(string));
            dtData.Columns.Add("病例数", typeof(string));
            dtData.Columns.Add("表单数", typeof(string));
            dtData.Columns.Add("开始日期", typeof(string));
            for (int i = 0; i < data.Rows.Count; i++)
            {
                DataRow newrow = dtData.NewRow();
                newrow["项目名称"] = data.Rows[i].ItemArray[0];
                newrow["负责人"] = data.Rows[i].ItemArray[1];
                newrow["病例数"] = data.Rows[i].ItemArray[3];
                newrow["表单数"] = data.Rows[i].ItemArray[4];
                newrow["开始日期"] = data.Rows[i].ItemArray[2];
                dtData.Rows.Add(newrow);
            }
            ExcelHelp.ExportByWeb(dtData, String.Empty, "经费来源单位统计.xls");

        }*/
    }
}

